import Vue from 'vue'
import Router from 'vue-router'
const login = () => import('../views/login/login.vue');
const Layout = () => import('../views/layout/Layout.vue');
const Home = () => import('../views/home/Home.vue');
const Manage = () => import('../views/manage/Manage.vue');
const SetSite = () => import('../views/manage/Set.vue');
const EditSite = () => import('../views/manage/Edit.vue');
const NewSite = () => import('../views/manage/New.vue');
const Product = () => import('../views/product/Product.vue');
const Order = () => import('../views/order/Order.vue');
const Article = () => import('../views/article/Article.vue');
const NewArticle = () => import('../views/article/NewArticle.vue');
const Comment = () => import('../views/comment/Comment.vue');
const Currency = () => import('../views/currency/Currency.vue');
const Pay = () => import('../views/pay/Pay.vue');
const User = () => import('../views/user/User.vue');
const Usergroup = () => import('../views/usergroup/Usergroup.vue');
const Usergroupadd = () => import('../views/usergroup/Usergroupadd.vue');
const ProductEdit = () => import('../views/product/edit.vue');
Vue.use(Router)

const router = new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: [{
        path: '/',
        name: 'Layout',
        component: Layout,
        meta: { type: 'login' },
        children: [
            {
                path: 'home',
                component: Home,
                name: 'Home'
            }, {
                path: '/manage',
                name: 'Manage',
                component: Manage,
            }, {
                path: '/manage/set/:site',
                name: 'Set',
                component: SetSite,
            }, {
                path: '/manage/edit/:site',
                name: 'Edit',
                component: EditSite,
            }, {
                path: '/manage/new/',
                name: 'New',
                component: NewSite,
            }, {
                path: '/product',
                name: 'Product',
                component: Product
            }, {
                path: '/product/edit/:id',
                name: 'ProductEdit',
                component: ProductEdit
            }, {
                path: '/order',
                name: 'Order',
                component: Order
            }, {
                path: '/article',
                name: 'Article',
                component: Article
            }, {
                path: '/newArticle/:id',
                name: 'NewArticle',
                component: NewArticle
            }, {
                path: '/comment',
                name: 'Comment',
                component: Comment
            }, {
                path: '/currency',
                name: 'Currency',
                component: Currency
            }, {
                path: '/pay',
                name: 'Pay',
                component: Pay
            }, {
                path: '/user',
                name: 'User',
                component: User
            }, {
                path: '/usergroup',
                name: 'Usergroup',
                component: Usergroup
            },
            {
                path: '/usergroupadd',
                name: 'Usergroupadd',
                component: Usergroupadd
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: login,
        meta: {
            title: 'login',
            type: '' // 不需要鉴权
        }
    }
    ]
})

export default router;
